//
//  JHSettingFuntTopView.m
//  JuniRengLish_iOS
//
//  Created by revogi on 2019/5/18.
//  Copyright © 2019 revogi. All rights reserved.
//

#import "JHSettingFuntTopView.h"

@implementation JHSettingFuntTopView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


- (void)awakeFromNib
{
    [super awakeFromNib];
     self.sureBtn.backgroundColor=JKMainColor;
    int founTag;
    
    NSString *fount=[kUserDefaults objectForKey:@"retFount"];
    if (fount) {
        founTag=[fount intValue]+10;
    }else{
        founTag=11;
    }
    UIButton * button = [self viewWithTag:founTag];
    button.selected = YES;
    self.fontSizeSelectedBtn = button;
}

+ (instancetype)defaultPopupView{
    return [[JHSettingFuntTopView alloc]initWithFrame:CGRectMake(0, 0, JKScreenW, 130)];
}


- (IBAction)selectedFuntBtnDidClock:(UIButton *)button {
    self.funtArray=@[@"0",@"1",@"2",@"3"];
    self.fount=[self.funtArray[button.tag-10] intValue];
    if (button!= self.fontSizeSelectedBtn) {
           self.fontSizeSelectedBtn.selected = NO;
           button.selected = YES;
            self.fontSizeSelectedBtn = button;
        }else{
            self.fontSizeSelectedBtn.selected = YES;
      }
        
    
    
}
- (IBAction)sureBtnDidClick:(UIButton *)sender {
    NSLog(@"%d----字体大小----",self.fount);

    [kUserDefaults setObject:[NSString stringWithFormat:@"%d",self.fount] forKey:@"retFount"];
    [kUserDefaults synchronize];
    if (self.sureBlock) {
        self.sureBlock();
    }
}

@end
